/**
 * Copyright (c) iwindplus Technologies Co., Ltd.2024-2030, All rights reserved.
 */

package com.iwindplus.gateway.server.domain.constant;

import com.iwindplus.boot.domain.constant.CommonConstant;
import org.springframework.core.Ordered;

/**
 * 常数.
 *
 * @author zengdegui
 * @since 2020/11/8
 */
public class GatewayConstant {
    private GatewayConstant() {
        throw new IllegalStateException(CommonConstant.UTILITY_CLASS);
    }

    /**
     * filter顺序相关常数 .
     */
    public static class FilterConstant {
        private FilterConstant() {
            throw new IllegalStateException(CommonConstant.UTILITY_CLASS);
        }

        /**
         * 基础过滤器顺序.
         */
        public static final Integer FILTER_BASE_ORDER = Ordered.HIGHEST_PRECEDENCE + 10;

        /**
         * IP黑名单过滤器顺序.
         */
        public static final Integer FILTER_IP_BLACK_LIST_ORDER = Ordered.HIGHEST_PRECEDENCE + 20;

        /**
         * API白名单过滤器顺序.
         */
        public static final Integer FILTER_API_WHITE_LIST_ORDER = Ordered.HIGHEST_PRECEDENCE + 30;

        /**
         * 认证过滤器顺序.
         */
        public static final Integer FILTER_AUTH_ORDER = Ordered.HIGHEST_PRECEDENCE + 40;

        /**
         * 日志过滤器顺序.
         */
        public static final Integer FILTER_LOG_ORDER = Ordered.HIGHEST_PRECEDENCE + 50;
    }

    /**
     * 路由相关常数 .
     */
    public static class RouteConstant {
        private RouteConstant() {
            throw new IllegalStateException(CommonConstant.UTILITY_CLASS);
        }

        /**
         * redis缓存key（路由-key）.
         */
        public static final String ROUTE_KEY = "serverRouteDefinition";

        /**
         * Nacos服务路由json.
         */
        public static final String NACOS_GATEWAY_ROUTER = "gateway-route.json";

        /**
         * Nacos服务路由分组.
         */
        public static final String NACOS_GATEWAY_GROUP = "GATEWAY_GROUP";

    }

    /**
     * Attribute相关常数 .
     */
    public static class ServerWebExchangeAttributeConstant {
        private ServerWebExchangeAttributeConstant() {
            throw new IllegalStateException(CommonConstant.UTILITY_CLASS);
        }

        /**
         * 请求头.
         */
        public static final String REQUEST_HEADERS = "requestHeaders";

        /**
         * 白名单标记.
         */
        public static final String WHITED_FLAG = "whitedFlag";

        /**
         * 开始时间.
         */
        public static final String BEGIN_TIME = "beginTime";
    }
}
